package worktools.utils;

import com.google.gson.Gson;

import java.util.Map;

/**
 * Created by bearworker on 17-3-27.
 */
public class CommUtils {

    private static Gson gson = new Gson();

    public static String getPubNetIp(){
        String url = "https://ipip.yy.com/get_ip_info.php";
        Map<String,Object> resmap = NetUtils.get(url);

        String ipInfo = resmap.get(NetUtils.convert.info).toString().split("=")[1];

        System.out.println(ipInfo);

        Map<String,String> ipMap = gson.fromJson(ipInfo.substring(0,ipInfo.indexOf(";")),Map.class);

        return ipMap.get("cip");
    }
}
